package org.swidgets.base.spanels;



import org.swidgets.base.BorderStyleRepository;

import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;



public class STitledPanel extends SimplePanel{
	protected final SFrame cornice=new SFrame();
	
	
	private static final boolean isDesignTime() {
		return false;
	}
	
	public void initSimplePanel(){
		super.add(cornice);	
		cornice.setStyle(BorderStyleRepository.titledPanel);
		cornice.addStyleName("fontZero");
		cornice.setHeight("100%");
	}
	public STitledPanel(){
		super();
		//this.initWidget(simplePanel);
		initSimplePanel();
		if(isDesignTime()){
			setCaption("TitledPanel");
			this.setHeight("100px");
			this.setWidth("100px");
			cornice.setWidth("100%");
		}
	}
	
	public STitledPanel(String caption){
		this();
		setCaption(caption);
	}
	
	public STitledPanel(String width,String height){
		super();
		//this.initWidget(simplePanel);
		initSimplePanel();
		this.setHeight(height);
		this.setWidth(width);
		
	}
	
	public void add(Widget w){
		cornice.setBodyWidget(w);
	}
	public void onBrowserEvent(Event event) {
		this.onBrowserEvent(event);
	}
	public void setCaption(String title) {
		cornice.setCaption(title);
	}
	
	public void setWidth(String width){
		this.setWidth(width);		
	}

	public void setHeight(String height){
		this.setHeight(height);		
	}

	public void clear() {
		cornice.clearContent();
	}



	public boolean remove(Widget w) {
		cornice.clearContent();
		return true;
	}
	
	
	
}
